package org.example.Controller;

import jakarta.annotation.Resource;
import org.example.common.Result;
import org.example.pojo.Comment;
import org.example.pojo.Query;
import org.example.service.CommentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("comment")
public class CommentController {
   @Resource
   private CommentService commentService;
    @PostMapping("/add")
    public Result add(@RequestBody Comment comment){
Result result=commentService.add(comment);
return result;
    }
    @PostMapping("/list")
    public Result list(@RequestBody Query query){
        Result result=commentService.selectlist(query);
        return result;
    }
    @PostMapping("/delete")
    public Result delete(Integer id){
        Result result=commentService.shanchu(id);
        return result;

    }
    @PostMapping("/all")
    public Result all(Integer userId){
        Result result=commentService.all(userId);
        return result;
    }
}
